import Vue from 'vue';
import Router from 'vue-router';



Vue.use(Router);

// 登录页面
const Login = resolve => require(['../container/other/Login.vue'], resolve);
// 404页面
const NotFound = resolve => require(['../container/other/404.vue'], resolve);
const Home = resolve => require(['../components/common/Home.vue'], resolve);

//! 路由分离引入
// 用户页面
import users from './user.js';
// 设备页面
import equipment from './equipment.js';
// 文件
import file from './file.js';
// 系统
import system from './system.js';
// 消息
import info from './info.js';

export default new Router({
    routes: [
        // !登录页面
        {
            path: '/',
            name: 'Login',
            component: Login,
            meta: {
                title: '登录'
            }
        }, {
            component: Home,
            path: '/Home',
            redirect: '/userMonitor',
            children: [
                ...users,
                ...equipment,
                ...file,
                ...system,
                ...info
            ]
        }, {
            path: '*',
            component: NotFound,
            meta: {
                title: '找不到页面'
            }
        }
    ]
})
